

/**ajax 提交请求 div内显示结果*/
function submit_ajax(url,options,divName){
	//alert(url);
	//alert(divName);
	if(divName == null ) divName="mainframe";
	var id = "#"+divName;
	$("#loadimgdiv").show();
	if(url.indexOf("?") > 0){
		url = url + "&systemtime="+new Date().getTime();
	}else{
		url = url+ "?systemtime="+new Date().getTime();
	}
	//url = encodeURI(url);
	$(id).load(url,options,function(responseText,status){
		$("#loadimgdiv").fadeOut(500);
	});
	//$(id).location(url);

	
}

/**ajax 提交请求 div内显示结果*/
function submit_ajax_redirect(url,options,loadUrl,divName){
	//alert(url);
	//alert(divName);
	if(divName == null ) divName="mainframe";
	var id = "#"+divName;
	$("#loadimgdiv").show();
	if(url.indexOf("?") > 0){
		url = url + "&systemtime="+new Date().getTime();
	}else{
		url = url+ "?systemtime="+new Date().getTime();
	}
	//url = encodeURI(url);
	$.getJSON(url,function(data,textStatus){
		
		if(textStatus = "success"){
			var url = null;
			if(data != null && data.url != null && data.url !="" ){
				
				url = data.url;
				
			}else if(loadUrl != null && loadUrl != ""){
				url = loadUrl;
			}
			
			if(url != null){
				if(url.indexOf("?") > 0){
					url = url + "&systemtime="+new Date().getTime();
				}else{
					url = url+ "?systemtime="+new Date().getTime();
				}
				$(id).load(url,function(responseText,status){
					$("#loadimgdiv").fadeOut(500);
				});
			}else{
				$("#loadimgdiv").hide();
				if(data.message != null && data.message != ""){
					var alertStr = data.message;
					if(data.description != null && data.description != ""){
						alertStr = alertStr + "<br/>"+ data.description;
					}
					alert(alertStr);
				}
			}
		}
	});
	

	
}

/**ajax 提交表单 div内显示结果*/
function submitForm_ajax(formId, loadUrl) {
	//alert(divName);
	var id = "#mainframe";
	var options = {type:"post", success:function (responseText, statusText) {
		//alert("\u64cd\u4f5c\u5b8c\u6210!");
		//alert(responseText);
		try{
				eval("var retObj="+responseText);
				var url = null;
				if(retObj.url != null && retObj.url !="" ){
					
					url = retObj.url;
					
				}else if(loadUrl != null && loadUrl != ""){
					url = loadUrl;
				}
				
				if(url != null){
					if(url.indexOf("?") > 0){
						url = url + "&systemtime="+new Date().getTime();
					}else{
						url = url+ "?systemtime="+new Date().getTime();
					}
					$(id).load(url,function(responseText,status){
						$("#loadimgdiv").fadeOut(500);
					});
				}else{
					
					$("#loadimgdiv").hide();
					if(retObj.message != null && retObj.message != ""){
						//alert(retObj.message);
						var alertStr = retObj.message;
						if(retObj.description != null && regObj.description != ""){
							alertStr = alertStr + "<br/>"+ retOjb.description;
						}
						alert(alertStr);
					}
				}
		}catch(e){alert(e);$("#loadimgdiv").fadeOut(500);}
		
	}};
	formId = "#" + formId;
	$("#loadimgdiv").show();
	$(formId).ajaxSubmit(options);
	return false;
}








		




